<template>
	<view class="bg-white radius overflow-hidden">
		<view class=" flex justify-between">
			<view class="w-20 relative">
				<view class="bg-10"></view>
				<view class="absolute left0 top0 w-100 h-100 overflow-hidden">
					<image class="w-100 h-100 " mode="aspectFill" :src="room.cover"></image>
					<text v-if="room.distance" class="bg-blue text-white padding-xs round-right absolute top0 left0 text-sm">{{room.distance}}</text>
					<uni-rate size="12" class="absolute right0 bottom0 padding-xs" v-model="room.rate"></uni-rate>
				</view>
			</view>
			<view class="w-80  flex flex-direction justify-between">
				<view>
					<view class="flex justify-between align-baseline padding-xs">
						<text class="text-sm text-bold ">{{room.sname}}</text>
						<text class="text-cut text-bold">{{room.rname}}</text>
					</view>
				</view>
				<view class="text-gray text-sm flex justify-between align-baseline padding-xs">
					<view class="text-gray flex justify-between align-baseline ">
						<text class="">{{tp[room.tp]}}</text>/
						<text class="">{{func[room.func]}}</text>/
						<text class="">{{room.mj}}㎡</text>
					</view>
					<view>
						<text @tap="toRoomDetail(room.roomid)" class="text-blue margin-left-xs">详细</text>
						<text v-if="showE" @tap="toRoomEdit(room.roomid)" class="text-blue margin-left-xs">编辑</text>
					</view>
				</view>
				<view v-if="room.address" class="nowrap overflow-hidden text-gray padding-xs">
					<!-- <text class="iconfont icon-weizhi text-blue"></text> -->
					<text class="text-sm">
						<text v-if="room.sheng">{{room.sheng}}</text>
						<text v-if="room.shi">{{room.shi}}</text>
						<text v-if="room.qu">{{room.qu}}</text>
						<text>{{room.address}}</text>
					</text>
				</view>
			</view>
		</view>
	</view>

</template>

<script>
	export default {
		props: {
			room: {
				type: Object,
				default: {}
			},
			showE: {
				type: Boolean,
				default: false
			},
			path: {
				type: String,
				default: ""
			}
		},
		data: function() {
			return {
				func: {},
				tp: {}
			};
		},
		created: function(){
			this.func = this.constant.roomfunc.ROOMFUNC;
			this.tp = this.constant.roomtp.ROOMTP;
		},
		methods: {
			toRoomDetail(roomid) {
				uni.navigateTo({
					url: this.path+'/detail?roomid='+roomid
				});
			},
			toRoomEdit(roomid) {
				uni.navigateTo({
					url: this.path+'/edit?roomid='+roomid
				});
			},
		}
	}
</script>

<style scoped>
	.kctitle {
		position: absolute;
		bottom: 0;
		width: 100%;
		display: flex;
		align-items: start;
		min-height: 100rpx;
		justify-content: space-between;
		flex-direction: column;
	}

</style>